package cn.kevinking.ai.mcp.provider.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author kevinking
 */
@ConfigurationProperties(McpProviderDiscoveryProperties.CONFIG_PREFIX)
@Data
public class McpProviderDiscoveryProperties {
	public static final String CONFIG_PREFIX = "bfz.ai.mcp.provider.discovery";
	public static final int CONNECTION_TIMEOUT = 3000;
	public static final int READ_TIMEOUT = 3000;
	private final Map<String, DiscoveryParameters> servers = new HashMap<>();

	public record DiscoveryParameters(String url) {
		public DiscoveryParameters {
			if (url != null) {
				url = url.replaceAll("/+$", "");
			}
		}
	}
}
